package tmp.arno;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SameArnoCount {
	public static void main(String[] args) throws SQLException {
		Connection con=DAO.DbcpConnection.getConnection();
		//con.setAutoCommit(false);
		Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
		ResultSet rs=st.executeQuery("select * from shopin_detail where arnofromarno is not null");
		Statement pst=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
		int k=0;
		while (rs.next()) {
			System.out.println(k++);
			String arno=rs.getString("arnofromarno");
			
			ResultSet prs=pst.executeQuery("select * from all_detail_pre where arno='"+arno+"'");
			if(prs.next()){
				int count=prs.getInt("match_shopin");
				count++;
				prs.updateInt("match_shopin",count);
				prs.updateRow();
			}
		}
		//con.commit();
	}
}
